//
//  GZXPlayerView.h
//  AVPlayerDemo
//
//  Created by ihope99 on 2017/7/31.
//  Copyright © 2017年 GYP. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import "AFNetworkReachabilityManager.h"


/**视频播放的状态**/
typedef NS_ENUM(NSInteger,GZXPlayerState) {
    GZXPlayerStateNomer = 0,
    GZXPlayerStateFailed = 1,        // 播放失败
    GZXPlayerStateBuffering = 2,     // 缓冲中
    GZXPlayerStateReadyToPlay = 3,  //将要播放
    GZXPlayerStatePlaying = 4,       // 播放中
    GZXPlayerStateStopped = 5,        //暂停播放
    GZXPlayerStateFinished = 6,       //播放完毕
    GZXPlayerStateInterrupt = 7 //播放异常中断
} ;


@interface GZXPlayerView : UIView

+(GZXPlayerView *)share;


/**
 *视频加载菊花
 */
@property (nonatomic, strong) UIActivityIndicatorView *mActivityView;
/**
 *底部View
 */
@property (nonatomic,strong)UIView *mBottomView;

/**
 *播放按钮/暂停按钮
 */
@property (nonatomic,strong)UIButton *mPlayFullButton;
/**
 *播放按钮/暂停按钮
 */
@property (nonatomic,strong)UIButton *mPlayButton;

/**
 *视频缓存进度条
 */
@property (nonatomic,strong)UIProgressView *mProgessView;

/**
 *是否在4G状态下播放
 */
@property (nonatomic,assign,)__block BOOL is_Net4G_Play;
///是否在wifi 状态下自动播放
@property (nonatomic,assign)BOOL is_NetWifi_play;
/**
 *当前网络状态
 */
@property (nonatomic,assign)__block AFNetworkReachabilityStatus NetStatus;

/**
 *视频播放进度条
 */
@property (nonatomic,strong)UISlider *mSlider;

/**
 *当前播放时间Label
 */
@property (nonatomic,strong)UILabel  *mCurrentTimeLabel;

/**
 *总播放时间Label
 */
@property (nonatomic,strong)UILabel  *mTotalTimeLabel;

/**
 *切换全屏按钮
 */
@property (nonatomic,strong)UIButton  *mFullScreenButton;

/**
 *判断缓存消息是否添加了 //防止闪退和出现同时出发2个通知
 */
@property (nonatomic,assign)BOOL IsResponseLoadedTime;

/**
 *视频
 */
@property (nonatomic,strong) AVPlayerItem *mPlayerItem;
/**
 *视频
 */
@property (nonatomic,strong) AVPlayerLayer *mPlayerLayer;
/**
 *视频
 */
@property (nonatomic,strong) AVPlayer *mPlayer;
/**
 *记录当前缓存的进度
 */
@property (nonatomic,assign)NSTimeInterval mNowloadedTime;
/**
 ＊  播放器状态
 */
@property (nonatomic, assign) GZXPlayerState   mPlayState;
/**
 *播放的链接
 */
@property (nonatomic,copy)NSString *mVideoUrlStr;
/**
 *是否全屏
 */
@property (nonatomic,assign)BOOL isFullScreen;

@property (nonatomic,assign)BOOL isDragSlider;


/**
 *进入后台前是否正在播放
 */
@property (nonatomic,assign)BOOL is_playing;

@property (nonatomic,weak)UIView *rootView;
@property (nonatomic,weak)UIViewController *rootCtrl;


@property (nonatomic)CGRect mSmallFrame;
@property (nonatomic)CGRect mBigFrame;


-(void)Pause;
-(void)Cancel;

@end
